﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace SangsTools
{
    public class TransformPosFollower : IPosFollower
    {
        public Transform tfFollow { get; private set; }
        public Transform tfTarget { get; private set; }
        public Vector3 vOffset;

        public TransformPosFollower(Transform follow, Transform target, Vector3 offset = default(Vector3))
        {
            tfFollow = follow;
            tfTarget = target;
            vOffset = offset;
        }
        public virtual void Follow()
        {
            if (tfFollow != null && tfTarget != null)
            {
                tfFollow.position = tfTarget.position + vOffset;
            }
        }
        public bool CheckIsEmpty()
        {
            return tfFollow == null || tfTarget == null;
        }
    }
}